home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Utilities ƒ / MPW Tools ƒ / Simula4.07 / Simula 4.07ƒ / SInterfaces / macDialog.sim < prev    next >
Encoding:
Text File  |  1989-05-01  |  5.2 KB  |  171 lines  |  [TEXT/MPS ]

  1. % ---------------------------------------------------------------------------
  2. %    Class MACDialog
  3. %
  4. % In this module you find the programmers interface to Dialogs and Alerts.
  5. % It is built on top of the TOOLBOX routines in TOOLBOXDialog.
  6. % For a description of the routines see Inside Macintosh, chapter 13.
  7. % MacDialogAlert is only used as prefix on MacDialog and MacAlert
  8. %
  9. % 890317/Boris Magnusson
  10. % 890412/Göran Eriksson
  11. %
  12. % ---------------------------------------------------------------------------
  13. %    {for Dialog Manager}
  14. %
  15. %    DialogPtr = WindowPtr;
  16. %    DialogPeek = ^DialogRecord;
  17. %    DialogRecord = RECORD
  18. %                     window: WindowRecord;
  19. %                     Items: Handle;
  20. %                     textH: TEHandle;
  21. %                     editField: INTEGER;
  22. %                     editOpen: INTEGER;
  23. %                     aDefItem: INTEGER;
  24. %                     END;
  25. %
  26. %    DialogTHndl = ^DialogTPtr;
  27. %    DialogTPtr = ^DialogTemplate;
  28. %    DialogTemplate = RECORD
  29. %                     boundsRect: Rect;
  30. %                     procID: INTEGER;
  31. %                     visible: BOOLEAN;
  32. %                     filler1: BOOLEAN;
  33. %                     goAwayFlag: BOOLEAN;
  34. %                     filler2: BOOLEAN;
  35. %                     refCon: LONGINT;
  36. %                     ItemsID: INTEGER;
  37. %                     title: Str255;
  38. %                     END;
  39. % ---------------------------------------------------------
  40. external text procedure Text_String="::SInterfaces:Text_String";
  41. external text procedure String_Text="::SInterfaces:String_Text";
  42. external class MACPoint="::SInterfaces:MACPoint";
  43. external class MACRect="::SInterfaces:MACRect";
  44. external class MACDialogAlert="::SInterfaces:MACDialogAlert";
  45. external class ToolboxDialog="::SInterfaces:ToolboxDialog";
  46.  
  47. MacDialogAlert class MacDialog;
  48. begin
  49.     short integer nil=0;
  50. %    FUNCTION GetNewDialog(dialogID: INTEGER; wStorage: Ptr;
  51. %                    behind: WindowPtr): DialogPtr;
  52.      procedure GetNewDialog(dialogID, behind);
  53.                     short integer dialogId;
  54.                     ref(MACWindow)  behind;
  55.     begin
  56.             WindowPtr:= TD.ToolboxGetNewDialog(dialogID,nil,
  57.                     if behind=/= none then behind.WindowPtr else -1);
  58.     end;
  59.  
  60. %    FUNCTION NewDialog(wStorage: Ptr; boundsRect: Rect; title: Str255;
  61. %                     visible: BOOLEAN; theProc: INTEGER; behind: WindowPtr;
  62. %                     goAwayFlag: BOOLEAN; refCon: LONGINT;
  63. %                     itmLstHndl: Handle): DialogPtr;
  64.      procedure NewDialog(boundsRect, title, visible, 
  65.                     theProc, behind,goAwayFlag, refCon, itmLstHndl);
  66.                     ref(MACRect) boundsRect;
  67.                     text title;
  68.                     boolean Visible;
  69.                     short integer theProc;
  70.                     ref(MACWindow) behind;
  71.                     boolean goAwayFlag;
  72.                     integer refCon, itmLstHndl;
  73.             begin
  74.                 text Temp;
  75.                 Temp:-util.Text_String(title);
  76.                 WindowPtr:=TD.ToolboxNewDialog(nil,
  77.                 boundsRect.top, temp, visible, theProc, 
  78.                 if behind=/= none then behind.WindowPtr else -1,
  79.                 goAwayFlag, refCon, itmLstHndl);
  80.             end;
  81.  
  82. %    PROCEDURE DrawDialog(theDialog: DialogPtr);
  83.     PROCEDURE DrawDialog;
  84.                 TD.ToolboxDrawDialog(WindowPtr);
  85.  
  86. %    PROCEDURE CloseDialog(theDialog: DialogPtr);
  87.     PROCEDURE CloseDialog;
  88.             TD.ToolboxCloseDialog(WindowPtr);
  89.  
  90. %    PROCEDURE DisposDialog(theDialog: DialogPtr);
  91.     PROCEDURE DisposDialog;
  92.                 TD.ToolboxDisposDialog(WindowPtr);
  93.                     
  94. %    PROCEDURE CouldDialog(DlgID: INTEGER);
  95. %    PROCEDURE ToolboxCouldDialog(DlgID);
  96. %                    short integer DlgId;
  97.  
  98. %    PROCEDURE FreeDialog(DlgID: INTEGER);
  99. %    PROCEDURE ToolboxFreeDialog(DlgID);
  100. %                    short integer DlgId;
  101.  
  102.  
  103. %    PROCEDURE GetDItem(theDialog: DialogPtr; itemNo: INTEGER; VAR kind: INTEGER;
  104. %                     VAR item: Handle; VAR box: Rect);
  105.     PROCEDURE GetDItem( itemNo, kind, item, box);
  106.                      name kind, item, box;
  107.                      short integer itemNo, kind;
  108.                      integer item;
  109.                      ref(MACRect) box;
  110.                 begin
  111.                     short integer localkind;
  112.                     integer localitem;
  113.                     ref(MACRect) LocalBox;
  114.                     LocalKind:=kind;
  115.                     LocalItem:=item;
  116.                     LocalBox:-box;
  117.                     TD.ToolboxGetDItem(WindowPtr, itemNo,LocalKind, LocalItem, LocalBox.Top);
  118.                     box:-LocalBox;
  119.                     item:=LocalItem;
  120.                     kind:=LocalKind;
  121.                 end;
  122.  
  123. %    PROCEDURE SetDItem(dialog: DialogPtr; itemNo: INTEGER; kind: INTEGER;
  124. %                     item: Handle; box: Rect);
  125.     PROCEDURE SetDItem(itemNo, kind, item, box);
  126.                      short integer itemNo, kind;
  127.                      integer item;
  128.                      ref(MACRect) box;
  129.                      TD.ToolboxSetDItem(WindowPtr, itemNo, kind, item, box.top);
  130.  
  131.  
  132. %    PROCEDURE SelIText(theDialog: DialogPtr; itemNo: INTEGER; startSel,
  133. %                     endSel: INTEGER);
  134.     PROCEDURE SelIText(itemNo, startSel, endSel);
  135.                      short integer itemNo, startSel, endSel;
  136.                      TD.ToolboxSelIText(WindowPtr, itemNo, startSel, endSel);
  137.  
  138. %    PROCEDURE DlgCut(theDialog: DialogPtr)" is
  139.  
  140. %    PROCEDURE DlgPaste(theDialog: DialogPtr)" is
  141.  
  142. %    PROCEDURE DlgCopy(theDialog: DialogPtr)" is
  143.  
  144. %    PROCEDURE DlgDelete(theDialog: DialogPtr)" is
  145.  
  146. %    PROCEDURE SetDAFont(fontNum: INTEGER);
  147. %    external Toolbox procedure x="$31DF, $0AFA" is" is
  148.  
  149. %    {new 128K ROM}
  150.  
  151. %    PROCEDURE HideDItem(theDialog: DialogPtr; itemNo: INTEGER);
  152.     PROCEDURE HideDItem(itemNo);
  153.             short integer itemNo;
  154.             TD.ToolboxHideDItem(WindowPtr, itemNo);
  155.  
  156. %    PROCEDURE ShowDItem(theDialog: DialogPtr; itemNo: INTEGER);
  157.     PROCEDURE ShowDItem(itemNo);
  158.             short integer itemNo;
  159.             TD.ToolboxShowDItem(WindowPtr, itemNo);
  160.  
  161. %    PROCEDURE UpdtDialog(theDialog: DialogPtr; updateRgn: RgnHandle);
  162. %    PROCEDURE ToolboxUpdtDialog(theDialog, updateRgn);
  163. %            integer theDialog. upDateRgn;;
  164.  
  165. %    FUNCTION FindDItem(theDialog: DialogPtr; thePt: Point): INTEGER;
  166.     short integer procedure FindDItem(thePt);
  167.         ref(MACPoint) thePt;
  168.         TD.ToolboxFindDItem(WindowPtr, thePt.h, thePt.v);
  169.     
  170.  
  171. end;